package 实验9;

import java.util.InputMismatchException;
import java.util.Scanner;

public class NumberFormatException {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		boolean isCon = true;
		while (isCon) {
			try {
				System.out.print("请输入两个整数：");
				System.out.printf("%d",s.nextInt() + s.nextInt());
				isCon = false;
			} catch (InputMismatchException e) {
				System.out.println("输入不合法！");
				s.nextLine();
				isCon = true;
			}
		}
		s.close();
	}
}
